/*
* @Author: wangliang
* @Date: 2018/4/12
* @description: 关联关系
*/
<template>
    <div class="custom-box p-20 m-t-20">
        <el-row>
            <el-col :span="5" class="ca-title">
                <h3>关联关系 ({{totalCount}})</h3>
            </el-col>
        </el-row>
        <el-table
            ref="multipleTable"
            stripe
            :data="data"
            style="width: 100%">
            <el-table-column
                label="ID"
                prop="id"
                align="center">
            </el-table-column>
            <el-table-column
                label="企业名称"
                prop="companyName"
                align="center">
            </el-table-column>
            <el-table-column
                label="企业身份"
                prop="companyIdentity"
                align="center">
            </el-table-column>
            <el-table-column
                label="信息名称"
                prop="informationName"
                align="center">
            </el-table-column>
            <el-table-column
                label="事件身份"
                prop="eventIdentity"
                align="center">
            </el-table-column>
            <el-table-column
                label="关联类型"
                prop="associationType"
                align="center">
                <template slot-scope="scope">
                    {{scope.row.associationType | getNameById("eventType")}}
                </template>
            </el-table-column>
            <el-table-column
                label="轮次"
                prop="investRound"
                align="center">
                <template slot-scope="scope">
                    {{scope.row.investRound | getNameById("roundList")}}
                </template>
            </el-table-column>
            <el-table-column
                label="发布时间"
                prop="publishTime"
                align="center">
                <template slot-scope="scope">
                    {{scope.row.publishTime | cmsMoment}}
                </template>
            </el-table-column>
            <el-table-column
                label="操作"
                align="center">
                <template slot-scope="scope">
                    <el-button  type="text" @click="jumpPage(scope.row.id)">编辑</el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="m-t-20" >
            <el-pagination
                layout="prev, pager, next"
                @current-change="handleCurrentChange"
                :current-page="pageParam.pageIndex"
                :page-size="10"
                :total="totalCount">
            </el-pagination>
        </div>
    </div>
</template>
<script lang="ts">
import Vue from 'vue';
import { Component, Watch } from 'vue-property-decorator';
import { PageParam } from '../../../../../api/Interface';
import RelationService from '../../../../../service/subject/company/basic-info/index';
@Component({
  components: { }
})
export default class BasicInfo extends Vue {
    // 初始化数据 相当于data
    // public msg: number = 123;
    public pageParam: PageParam = {pageIndex: 1, pageSize: 10} as PageParam; // <PersonVo> {}
    public tabIndex: number = 0;
    public valueTime: string = '';
    public inputValue: string = '';
    public checkList: string[] = [];
    public data: object[] = [];
    public totalCount: number = 0;
    public dialogVisible: boolean = false;
    public innerVisible: boolean = false;
    // refs
    public $refs: { };

    // watch
    @Watch('msg')
    public onChildChanged(val: string, oldVal: string) {
        return val + '***';
    }

    // 声明周期钩子
    public mounted() {
        this.getRelationList();
    }

    // 方法
    // 更改页码
    public handleCurrentChange(val: number) {
        this.pageParam.pageIndex = val;
        this.getRelationList();
    }
    // 获取关联关系列表
    public async getRelationList() {
        const query = {
            'pageParam.pageIndex': this.pageParam.pageIndex,
            'pageParam.pageSize': this.pageParam.pageSize,
            companyId: Number(this.$route.params.itemId),
        };
        const res = await RelationService.getCompanyRelationPage(query);
        if (res.resCode === '0') {
            this.data = res.data.resultData;
            this.totalCount = res.data.totalCount;
        }
    }
    // 页面跳转到事件
    public jumpPage(id: string) {
        this.$router.push({name: 'transaction-detail', params: {eventId: id, tabIndex: '0'}});
    }

}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.ca-title h3{
    font-weight: normal;
    font-size: 18px;
    color: #333333;
    float: left;
}
.line-h {
    line-height: 36px;
}
.addBtn {
    font-size: 22px;
    margin-top: 12px;
    margin-left: 10px;
}
.el-checkbox+.el-checkbox {
    margin-right: 10px;
}
.el-checkbox {
    color: #606266;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    margin-left: 10px;
}
</style>